<template>
  <div class="container">
    <div>
      <a-button type="primary" @click="addEntity">
        <template #icon><icon-plus-circle /></template>添加
      </a-button>
    </div>
    <a-table :bordered="{cell:true}" :pagination="false" stripe :data="state.entityObj">
      <template #columns>
        <a-table-column title="车间名称" data-index="name"></a-table-column>
        <a-table-column title="车间主任" data-index="adminuser"></a-table-column>
        <a-table-column title="操作" width="200">
          <template #cell="{ record }">
            <a-space>
              <a-button type="primary" size="small" @click="editEntity(record.id)"><template #icon><icon-edit /></template>修改</a-button>
            </a-space>
          </template>
        </a-table-column>
      </template>
    </a-table>

    <a-card title="功能介绍" class="mt15">
      <h4 style="color: #f60000">车间的基础数据管理，用于工序转序，需要跨车间接收半成品的场景。你可以当成基础数据维护，或者放到数据字典进行配置</h4>
    </a-card>
  </div>
</template>

<script lang="ts" setup>
import { Message } from '@arco-design/web-vue'
import {reactive, ref, onMounted, onUnmounted, defineAsyncComponent} from "vue";
import { useRouter } from "vue-router";
const router = useRouter();

const state = reactive({
  entityObj: [],
  entityDetailVisible : false,
  popupTitle : '',
  popupEntityId : 0,
})
const loadList = ()=>{
  state.entityObj = [
    {id : 1, name : '棒材下料车间', adminuser:'王恩咸'},
    {id : 2, name : '棒材锻压车间', adminuser:'常乐'},
    {id : 3, name : '棒材机加工车间', adminuser:'Admin'},
  ]
}
const addEntity = ()=>{
  //state.popupEntityId = Math.floor(Math.random() * 100000) * -1;
  Message.warning("功能未开")
}
const editEntity = (id)=>{
  Message.warning("功能未开")
}
const deleteEntity = (id)=>{
  Message.warning("功能未开")
}
onMounted(()=>{
  loadList();
})
onUnmounted(()=>{
})
</script>

<style scoped>

</style>
